﻿using System.Xml.Linq;

namespace System.ServiceManager.Facade
{
    public class SimpleExpression : CriteriaElement
    {
        private readonly string property;
        private readonly string value;
        private readonly string expressionOperator;
         
        public SimpleExpression(XNamespace ns, string property, string value, string expressionOperator): base(ns)
        {
            this.property = property;
            this.value = value;
            this.expressionOperator = expressionOperator;
        }

        internal override XElement ToXElement()
        {
            return new XElement(Namespace + "Expression",
                                new XElement(Namespace + "SimpleExpression",
                                             new XElement(Namespace + "ValueExpressionLeft",
                                                          new XElement(Namespace + "Property", property)),
                                             new XElement(Namespace + "Operator", expressionOperator),
                                             new XElement(Namespace + "ValueExpressionRight",
                                                          new XElement(Namespace + "Value", value)))
                );
        }
    }
}